package com.efuture.netrequestdemo.network

import com.efuture.netrequestdemo.bean.Project
import com.efuture.netrequestdemo.bean.User
import kotlinx.coroutines.Deferred
import retrofit2.Call
import retrofit2.Response
import retrofit2.http.*

/**

 *@description:api接口
 * @author: zhaoshanshan
 * @date: 2022/3/24 5:38 下午
 */
//@JvmSuppressWildcards 用来注解类和方法，使得被标记元素的泛型参数不会被编译成通配符?
interface ApiService {

    //用户注册
    @POST("/user/register")
    @FormUrlEncoded
    fun registerUser(@FieldMap map: Map<String, @JvmSuppressWildcards Any>):Deferred<Response<User>>

    //用户注册
//    @POST("/user/register")
//    @FormUrlEncoded
//    fun registerUser(@Field("username") username: String,
//                          @Field("password") password: String,
//                          @Field("repassword") repassword: String):Deferred<Response<User>>

//    //用户登录
    @FormUrlEncoded
    @POST("/user/login")
    fun loginUser(@FieldMap map:Map<String, @JvmSuppressWildcards Any>):Deferred<Response<User>>

    //项目列表数据获取
    @GET("/project/list/1/json")
    fun getProjectData(@QueryMap map:Map<String,@JvmSuppressWildcards Any>):Deferred<Response<Project>>


    //项目列表数据获取
//    @GET("/project/list/1/json")
//    fun getProjectData(@Query("cid") cid:String):Deferred<Response<Project>>
}